from SCons.Script import Environment
from SCons.Util import Split
import os

print(os.getcwd())

env = Environment(CC = 'gcc')
env.Append(CXXFLAGS=['./', './color.h'])
env.Append(CPPFLAGS=['-Werror', '-Wall', '-Wextra'])
env.Append(HEADERS=Split("./"))
env.Append(CPPDEFINES=['_LINUX_']) 
# env.AppendUnique(CCFLAGS=('-isystem', './'))
env.Append(CCFLAGS='-std=c11 -O2 -DHELLOSCONS')

include_path = Split("./ ./include ./lib *.h ./include/*.h ./lib/*.h")

TARGETNAME = 'app'               # 设置要编译的二进制程序名称
LIB = Split('mylib m')                    # 库名字
LIB_DIR = Split('./ ./lib')                 # 库路径
FILELIST = env.Glob('./src/*.c')          # 源文件
HEADFILEPATH = include_path         # 头文件

print(HEADFILEPATH)
# print(env.Dump())

# mylib = env.Library('lib/mylib', ['lib/mylib.c'])
# FILELIST.append(mylib)
env.Program(target = TARGETNAME, source = FILELIST, LIBS = LIB, CPPPATH = HEADFILEPATH, LIBPATH = LIB_DIR)